N,M,K=map(int,input().split())

a=[]
for i in range(N):
    a.append(list(map(int,input().split())))


def count_submatrices(matrix, rows, cols, k):
    count = 0

    for i in range(rows):
        for j in range(cols):
            for m in range(i, rows):
                for n in range(j, cols):
                    submatrix_sum = 0
                    # 统计子矩阵
                    for x in range(i, m + 1):
                        for y in range(j, n + 1):
                            submatrix_sum += matrix[x][y]
                    if submatrix_sum <= k:
                        count += 1

    return count

ans=count_submatrices(a,N,M,K)
print(ans)
